package com.jy.rhin.domain.audit;

import com.jy.rhin.domain.audit.entity.AuditInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author MaYuXuan
 * @date 2022年6月21日 08:45:19
 * @Description 审计信息域服务
 */
@Service
public class AuditInfoDomainService {

    @Resource
    AuditInfoDao auditInfoDao;

    @Transactional(rollbackFor = Exception.class)
    public Long save(AuditInfo auditInfo, AuditInfo auditStatus) {
        auditInfo.init();
        auditInfo.setCheckStatus(auditStatus.isCheckStatus());
        auditInfo.setFailureReason(auditStatus.getFailureReason());
        return auditInfoDao.save(auditInfo);
    }

}
